<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2018/7/27
  Time: 10:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>出库新增</title>


</head>

<body>

<form  action="" class="form-horizontal" role="form" id="myForm" >
    <div class="modal fade bs-example-modal-lg" id="myModal"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" aria-hidden="true" data-backdrop="static">
        <!--  定义模态框，过渡效果为淡入，id为myModal,tabindex=-1可以禁用使用tab切换，aria-labelledby用于引用模态框的标题，aria-hidden=true保持模态框在触发前窗口不可见  -->
        <div class="modal-dialog modal-lg">
            <!--  显示模态框对话框模型（若不写下一个div则没有颜色）  -->
            <div class="modal-content">
                <!--  显示模态框白色背景，所有内容都写在这个div里面  -->

                <div class="btn-info modal-header">
                    <!--  模态框标题  -->
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <!--  关闭按钮  -->
                    <h4>出库单添加</h4>
                    <!--  标题内容  -->
                </div>

                <div class="modal-body">
                    <!--  模态框内容，我在此处添加一个表单 -->

                    <div class="form-group">
                        <label  class="col-sm-2 control-label">领用部门</label>
                        <div class="col-sm-9">
                            <select class="js-data-example-ajax form-control" name="pame">
                                <option value="1">财务部</option>
                                <option value="2">销售管理部</option>
                                <option value="3">工程研发部</option>
                                <option value="4">生产部</option>
                                <option value="5">供应部</option>
                                <option value="6">总经办</option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label  class="col-sm-2 control-label">经办人</label>
                        <div class="col-sm-9">
                            <select class="js-data-example-ajax form-control" name="man">
                                <option value="1">广东</option>
                                <option value="2">广西</option>
                                <option value="2">广西2</option>
                                <option value="2">广西3</option>
                                <option value="2">广西4</option>
                                <option value="2">广西5</option>
                                <option value="2">广西6</option>
                                <option value="2">广西7</option>
                                <option value="2">广西8</option>
                                <option value="2">广西9</option>
                                <option value="2">广西10</option>
                            </select>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">出库类型</label>
                        <div class="col-sm-9">
                            
                            <select class="js-data-example-ajax form-control" name="otype">
                                <option value="一般出库">一般出库</option>
                                <option value="借还出库">借还出库</option>
                            </select>
                            
                        </div>
                    </div>
                    
                    
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">出库时间</label>
                        <div class="col-sm-9">
                            <div class='input-group date' id='datetimepicker2' >
                                <input type='text' class="form-control" name="time"/>
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                    </div>  
                    
                    
                    <!-- <div class="form-group">
                        <label  class="col-sm-2 control-label">货物分类</label>
                        <div class="col-sm-9">
                            
                            <select class="js-data-example-ajax form-control" name="gotype">
                                <option value="1">强电</option>
                                <option value="2">弱点</option>
                                <option value="3">机械</option>
                                <option value="4">通暖</option>
                                <option value="5">材料</option>
                                <option value="6">食品</option>
                                <option value="7">其他</option>
                            </select>
                            
                        </div>
                    </div> 
                    
                    <div class="form-group">
                        <label  class="col-sm-2 control-label">出库货物</label>
                        <div class="col-sm-9">
                            
                            <select class="js-data-example-ajax form-control" name="gotype">
                                <option value="1">强电</option>
                                <option value="2">弱点</option>
                                <option value="3">机械</option>
                                <option value="4">通暖</option>
                                <option value="5">材料</option>
                                <option value="6">食品</option>
                                <option value="7">其他</option>
                            </select>
                            
                        </div>
                    </div> --> 
                     
                     


                </div>

                <div class="modal-footer">
                    <!--  模态框底部样式，一般是提交或者确定按钮 -->
                    <button type="button" class="btn btn-info" id="submit">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>

            </div><!-- /.modal-content -->
        </div>
    </div> <!-- /.modal -->
</form>

<script>
    $(function () {
    	
    	 //多选
        $("#sel_menu2").select2({
        	 language: "zh-CN", //设置 提示语言
	       	 width: "100%", //设置下拉框的宽度
	         placeholder: "请选择",
	         tags: true,
	         maximumSelectionLength: 3,  //设置最多可以选择多少项
             allowClear: true,//允许清空			  
        	 ajax: {
        		url: 'godown/listOrder.do',
        		type:'GET',
        		dataType: 'json',
        		data: function(){ 
        			
        			return {'projectId':$('#projectSel').val()}
        		},
        		processResults: function (data) {
        			 return {
        				        results: data.result
        				 };
        		 	}
        		}
        });
    	
    	toastr.options.positionClass = 'toast-top-center';

        $('#datetimepicker2').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss',
            locale: moment.locale('zh-cn')
        });
        
        $('#submit').click(function() {
        	
        	$.ajax({
        		type:"POST",
        		url:'partOutOrder/insert.do',
        		data: $('#myForm').serialize(),
        		success:function(data) {
        			
        			if(data.success) {
        				
        				$("#myModal").modal('hide');
        				
        				toastr.success("添加成功!"); 
        				
        				$('#tb_departments').bootstrapTable('refresh');
        				
        			}else {
        				
        			}
        			
        		}
        	});
        	
        });
        
    });
    
   
</script>

</body>
</html>

